﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace ShopMobile_App
{
    public partial class frmMain : Form
    {
        public frmMain()
        {
            InitializeComponent();
        }

        private void frmMain_Load(object sender, EventArgs e)
        {
            menuStrip1.Enabled = false;
            groupBoxLogin.Visible = true;
            lbError.Text = "";
            txtUser.Text = "";
            txtPasswd.Text = "";
        }

        private void nhàSảnXuấtToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmCategory f = new frmCategory();
            f.ShowDialog();
        }

        private void sảnPhẩmToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmItems f = new frmItems();
            f.ShowDialog();
        }

        private void đơnĐặtHàngToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmCart f = new frmCart();
            f.ShowDialog();
        }

        private void đăngXuấtToolStripMenuItem_Click(object sender, EventArgs e)
        {
            menuStrip1.Enabled = false;
            groupBoxLogin.Visible = true;
            lbError.Text = "";
            txtUser.Text = "";
            txtPasswd.Text = "";
        }

        private void btnLogin_Click(object sender, EventArgs e)
        {
            AdminBLL ad = new AdminBLL();
            ad.password = txtPasswd.Text.Trim();
            ad.username = txtUser.Text.Trim();
            if (ad.chkLoginAdmin(ad))
            {
                menuStrip1.Enabled = true;
                groupBoxLogin.Visible = false;
                lbError.Text = "Đăng nhập thành công!";
            }
            else
            {
                lbError.Text = "Thông tin đăng nhập sai!";
            }
            
        }

        private void thoátToolStripMenuItem_Click(object sender, EventArgs e)
        {
            
        }

        private void thốngKêToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmStatistics f = new frmStatistics();
            f.ShowDialog();
        }

    }
}
